import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routerPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return routerPush.call(this, location).catch(error => error);
};

const routes = [
    {
        path: "/",
        component: () => import("@/views/Main"),
        children: [
            {
                path: "/",
                name: "index",
                component: () => import("@/views/Index/Index"),
                meta:{
                    // 页面标题title
                    title: '宁证期货'
                }
            },{
                path: "/login/:mid",
                name: "login",
                component: () => import("@/views/Login/Login"),
                meta:{
                    // 页面标题title
                    title: '登陆/注册'
                }
            },{
                path: "/Read/ReadPdf/:id",
                name: "ReadReadPdf",
                component: () => import("@/views/Read/ReadPdf"),
                meta:{
                    // 页面标题title
                    title: '宁证期货'
                }
            },{
                path: "/Read/List/:id",
                name: "ReadList",
                component: () => import("@/views/Read/List"),
                meta:{
                    // 页面标题title
                    title: '宁证期货'
                }
            },{
                path: "/Wskh/Index",
                name: "WskhIndex",
                component: () => import("@/views/Wskh/Index"),
                meta:{
                    // 页面标题title
                    title: '网上开户'
                }
            }
        ]
    }
];

const router = new VueRouter({
    routes,
    routerPush
});

export default router;
